#pragma once
/*from nettle*/
#include "typedef.h"
#define SHA512_DIGEST_SIZE   64
#define SHA512_BLOCK_SIZE    128
#define SHA512_DIGEST_LENGTH 8

typedef struct sha512_ctx sha512_ctx_t;

struct sha512_ctx {
    uint64_t     state[SHA512_DIGEST_LENGTH];
    uint64_t     count_low, count_high;
    unsigned int index;
    uint8_t      block[SHA512_BLOCK_SIZE];
};

void sha512_init(struct sha512_ctx* ctx);

void sha512_update(struct sha512_ctx* ctx, const uint8_t* data, size_t length);

void sha512_final(struct sha512_ctx* ctx, uint8_t* digest, size_t length);
